import { ref } from 'vue'
import { defineStore } from 'pinia'
import { GetAgreementApi } from '@/service/index.js'
export const useCommStore = defineStore('commStore', () => {
	const comm = ref({
		register_rule: '', //用户协议
		about_us: '', //关于我们
		privacy_policy: '', //	隐私政策
		web_site_logo: '', //平台LOGO
		complaint_cause: '', //投诉类型
		fankui_msg: '', //反馈类型
		company_recruit: '', //公司招聘
		function_msg: '', //功能介绍
		logout_msg: '', // 注销说明
		daili_msg: '', //代理说明
    hellp_mobile: '', // 平台客服
    hellp_mobile2: '', // 骑手端客服
    hellp_mobile3: '', // 商家端客服
    hellp_mobile4: '' // 代理端客服
	})
	const SETCOMM = () => {
		GetAgreementApi().then(res => {
			comm.value = res
		})
	}
	return {
		comm,
		SETCOMM
	}
}, {
  // 数据持久化
	persist: {
		storage: {
			getItem: (key) => {
			  return uni.getStorageSync(key)
			},
			setItem: (key, value) => {
			  return uni.setStorageSync(key, value)
			},
		}
	}
})
